/**
 * All rights Reserved, Designed By OprCalf
 * Copyright:    Copyright(C) 2016-2020
 * Company       OprCalf Ltd.
 */

package com.platform.gateway.common.exception;

import lombok.Getter;
import lombok.Setter;

/**
 * @projectName:  widget-api-spring-boot-starter
 * @package:      com.widget.exception
 * @className:    CommonRuntimeException.java
 * @description:  全局公共异常类
 * @author:       OprCalf
 * @date:         2018年12月24日
 */
public class CommonRuntimeException extends RuntimeException {

    private static final long serialVersionUID = 1L;

    @Setter
    @Getter
    private String errorMsg;

    public CommonRuntimeException(Throwable e, String errorMsg) {
        super(errorMsg, e);
    }

    public CommonRuntimeException(String errorMsg) {
        this(null, errorMsg);
    }

    public CommonRuntimeException(Throwable e) {
        this(e, null);
    }

    public CommonRuntimeException() {
    }

    @Override
    public String getMessage() {
        return super.getMessage();
    }

    /**
     * 重写fillInStackTrace 业务异常不需要堆栈信息，提高效率.
     * @author OprCalf
     * @return
     */
    @Override
    public Throwable fillInStackTrace() {
        return this;
    }
}
